﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MusicPlayerPlus.Core.Reflection
{
    public class RInterfaceBase : ReflectionBase<MusicPlayerPlus.Interface.Base.InterfaceBase>
    {
        /// <summary>
        /// 实例化继承该接口的所有方法
        /// </summary>
        /// <param name="item"></param>
        /// <param name="obj"></param>
        public object Execute(Type item)
        {
            if (IsSucceed(item))
            {
                if (AddExtTypeItem(item))
                {
                    return Instantiation(item);
                }
            }
            return null;
        }
        /// <summary>
        /// 实例化继承该接口的所有方法
        /// </summary>
        /// <param name="item"></param>
        /// <param name="obj"></param>
        private object Instantiation(Type classType)
        {
            object obj = classType.GetConstructor(Type.EmptyTypes).Invoke(null);
            return obj;
        }
    }
}
